<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/includes/main.jsp"%>

<form id="pagerForm" action="tripModels.action">
	<input type="hidden" name="pageInfo.currentPage" value="${tripModelPageInfo.currentPage}" />
	<input type="hidden" name="pageInfo.sorterName" value="${tripModelPageInfo.sorterName}" />
	<input type="hidden" name="pageInfo.sorterDirection" value="${tripModelPageInfo.sorterDirection}" />
	<input type="hidden" name="lookup" value="${lookup}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" method="post" action="tripModels.action?lookup=${lookup}" onsubmit="return dwzSearch(this, '${targetType}');">
	<input type="hidden" name="pageInfo.pageSize" value="${tripModelPageInfo.pageSize}" />
	<div class="searchBar">
		<ul class="searchContent">	
			<li>
				<label><hi:text key="线路名称" entity="TripModel"/>:</label>
				<input type="text" name="pageInfo.f_trip_name" value="${tripModelPageInfo.f_trip_name}"/>
			</li>	  
			<li>
				<label><hi:text key="线路编号" entity="TripModel"/>:</label>
				<input type="text" name="pageInfo.f_trip_code" value="${tripModelPageInfo.f_trip_code}"/>
			</li>	  
			<li>
				<label><hi:text key="地区" entity="TripModel"/>:</label>
				<hi:search name="pageInfo.f_trip_area" emu="area"/>
			</li>	  
			<li>
				<label><hi:text key="国家" entity="TripModel"/>:</label>
				<input type="text" name="pageInfo.country.f_country_name" value="${tripModelPageInfo.country.f_country_name}"/>
			</li>	  
			<li>
				<label><hi:text key="旅行主题" entity="TripModel"/>:</label>
				<input type="text" name="pageInfo.theme.f_title" value="${tripModelPageInfo.theme.f_title}"/>
			</li>	  
		</ul>
		<div class="subBar">
			<div class="buttonActive"><div class="buttonContent"><button type="submit"><hi:text key="查询"/></button></div></div>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" width="100%" layoutH="138" targetType="${targetType}">
		<thead>
			<tr>
				<th orderField="trip_name" class="${tripModelPageInfo.sorterName eq 'trip_name' ? pageInfo.sorterDirection : ''}"><hi:text key="线路名称" entity="TripModel"/></th>
				<th orderField="trip_code" class="${tripModelPageInfo.sorterName eq 'trip_code' ? pageInfo.sorterDirection : ''}"><hi:text key="线路编号" entity="TripModel"/></th>
				<th orderField="price" class="${tripModelPageInfo.sorterName eq 'price' ? pageInfo.sorterDirection : ''}"><hi:text key="参考价格" entity="TripModel"/></th>
				<th orderField="days" class="${tripModelPageInfo.sorterName eq 'days' ? pageInfo.sorterDirection : ''}"><hi:text key="旅行天数" entity="TripModel"/></th>
				<th orderField="trip_area" class="${tripModelPageInfo.sorterName eq 'trip_area' ? pageInfo.sorterDirection : ''}"><hi:text key="地区" entity="TripModel"/></th>
				<th orderField="country.country_name" class="${tripModelPageInfo.sorterName eq 'country.country_name' ? pageInfo.sorterDirection : ''}"><hi:text key="国家" entity="TripModel"/></th>
				<th orderField="theme.title" class="${tripModelPageInfo.sorterName eq 'theme.title' ? pageInfo.sorterDirection : ''}"><hi:text key="旅行主题" entity="TripModel"/></th>
				<th width="90">
					<c:choose>
						<c:when test="${empty lookup}"><hi:text key="操作"/></c:when>
						<c:otherwise><hi:text key="查找带回"/></c:otherwise>
					</c:choose>
				</th>
			</tr>
		</thead>				
		<tbody>
			<c:forEach var="item" items="${tripModels}" varStatus="s">
			<tr>
				    <td>
				    	<authz:authorize ifAnyGranted="TRIPMODEL_VIEW"><a href="<hi:url>tripModelView.action?tripModel.id=${item.id}&workflow=-1</hi:url>" target="dialog"></authz:authorize>
				    	${item.trip_name}
				    	<authz:authorize ifAnyGranted="TRIPMODEL_VIEW"></a></authz:authorize>
				    </td>
				    <td>${item.trip_code}</td>
				    <td>${item.price}</td>
				    <td>${item.days}</td>
				    <td><hi:select emu="area" name="tripModels[${s.index}].trip_area" isLabel="true"/></td>
				    <td><authz:authorize ifAnyGranted="COUNTRY_VIEW"><a href="<hi:url>countryView.action?country.id=${item.country.id}&workflow=-1</hi:url>" target="dialog"></authz:authorize>
					${item.country.country_name}
					<authz:authorize ifAnyGranted="COUNTRY_VIEW"></a></authz:authorize>
					</td>
				    <td><authz:authorize ifAnyGranted="TRIPTHEME_VIEW"><a href="<hi:url>tripThemeView.action?tripTheme.id=${item.theme.id}&workflow=-1</hi:url>" target="dialog"></authz:authorize>
					${item.theme.title}
					<authz:authorize ifAnyGranted="TRIPTHEME_VIEW"></a></authz:authorize>
					</td>
				<td>
					<c:choose>
						<c:when test="${empty partner}">
							<a class="btnLook" href="<hi:url>customerBook.action?tripModelId=${item.id}</hi:url>" target="navTab" rel="tripModels?customer=1" title="<hi:text key="直客预订" parameterLanguageKeys=""/>"><hi:text key="直客预订"/></a>
						</c:when>
						<c:otherwise>
							<a class="btnLook" href="<hi:url>partnerBook.action?tripModelId=${item.id}</hi:url>" target="navTab" rel="tripModels?partner=1" title="<hi:text key="同行预订" parameterLanguageKeys=""/>"><hi:text key="同行预订"/></a>
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>	
	<div class="panelBar">
		<div class="pages">
			<span><hi:text key="每页"/></span>
			<c:set var="pageSizeList" value="${fn:split('10|20|50|100', '|')}"/>  
			<select name="pageInfo.pageSize" onchange="dwzPageBreak({targetType:'${targetType}', numPerPage:this.value})">
				<c:forEach var="item" items="${pageSizeList}">
				<option value="${item}" ${item eq pageInfo.pageSize ? 'selected="selected"' : ''}>${item}</option>
				</c:forEach>
			</select>
			<span><hi:text key="条"/>，<hi:text key="共"/>${tripModelPageInfo.totalRecords}<hi:text key="条"/></span>
		</div>
		<div class="pagination" targetType="${targetType}" totalCount="${tripModelPageInfo.totalRecords}" numPerPage="${tripModelPageInfo.pageSize}" pageNumShown="${tripModelPageInfo.middlePageNum*2}" currentPage="${tripModelPageInfo.currentPage}"></div>
	</div>
</div>

<script type="text/javascript">
<!--
//-->
</script>